/*
 * @Author: 吴世扬 18368095041@163.com
 * @Date: 2025-02-11 17:00:22
 * @LastEditors: 吴世扬 18368095041@163.com
 * @LastEditTime: 2025-02-26 08:46:09
 * @FilePath: /vue3-admin-server/src/common/utils/res.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { ResponseCodeEnum } from 'src/common/constants';

export const errorRes = <T>(msg = '操作失败', data?: T): VO.ResultVO<T> => {
    return {
        code: ResponseCodeEnum.ERROR,
        msg,
        data
    };
};

export const successRes = <T>(msg = '操作成功', data?: T): VO.ResultVO<T> => {
    return {
        code: ResponseCodeEnum.SUCCESS,
        msg,
        data
    };
};

export const unauthorizedRes = <T>(
    msg = '需要登录',
    data?: T
): VO.ResultVO<T> => {
    return {
        code: ResponseCodeEnum.ERROR,
        msg,
        data
    };
};
